import java.util.Scanner;

public class Task04 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入应收金额：");
        int money = scanner.nextInt();
        System.out.println("请输入实收金额：");
        int earn = scanner.nextInt();
        if (money < earn) {
            throw new IllegalArgumentException("应收金额应该大于实收金额");
        }
        int[] arr = new int[6];
        int[] arr1=new int[]{100,50,20,10,5,1};
        int temp=money-earn;
        while (temp>0) {
            if (temp >= 100) {
                temp-=100;
                arr[0]++;
                continue;
            }
            if (temp >= 50) {
                temp-=50;
                arr[1]++;
                continue;
            }
            if (temp >= 20) {
                temp-=20;
                arr[2]++;
                continue;
            }
            if (temp >= 10) {
                temp-=10;
                arr[3]++;
                continue;
            }
            if (temp >= 5) {
                temp-=5;
                arr[4]++;
                continue;
            }
            if (temp >= 1) {
                arr[5]++;
                temp-=1;
            }
        }
        System.out.println("应找金额为：");
        for (int i = 0; i < 6; i++) {
            System.out.println(arr1[i]+"元："+arr[i]+"张");
        }
    }
}
